home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / coreaids.zip / SRCH_PRE.ASM < prev    next >
Assembly Source File  |  1987-06-25  |  2KB  |  95 lines

  1. ;    DESC:    search for the previous file of a set of filenames   V1.00
  2. ;
  3. ;    ***    CX must be loaded with the appropriate file attribute
  4. ;        to search on (1:read only,2:hidden file,
  5. ;         4:system file,8:volume label,10H:sub-directory,
  6. ;         20H:archived file).                              ***
  7. ;
  8. ;    IN:    *{SEG_VAL} segment and
  9. ;        *{OFFSET} offset of search string
  10. ;    OUT:    *{TIME} time file last written
  11. ;        *{DATE} date file last written
  12. ;        *{SIZE_LO} low word of file size
  13. ;        *{SIZE_HI} high word of file size
  14. ;        *{OUT_SEG} segment and
  15. ;        *{OUT_OFF} offset of first matching filename
  16. ;        *{LENGTH} length of filename found, 0 if not found
  17. ;    SAMPLE:    SRCH_PRE,<SEG_VAL,OFFSET>,
  18. ;                 <TIME,DATE,SIZE_LO,SIZE_HI,OUT_SEG,OUT_OFF,LENGTH>
  19. ;    ################################################################
  20.  
  21. SRCH_FID Segment Para Common 'DATA'
  22. TRANSFER    DB    80H DUP(0)        ;temporary data transfer area.
  23. THIRTY        DW    30            ;value of number thirty.
  24. SEGER        DW    0            ;segment and offset of stored
  25. OFFER        DW    0            ;old data area.
  26. CFILE        DW    0            ;current file number.
  27. PFILE        DW    0            ;previous file number.
  28. SRCH_FID ENDS
  29.  
  30.  
  31.     Extrn    PUSHALL:Near
  32.     Extrn    POPALL:Near
  33.     Extrn    SRCH_NXT:Near
  34.  
  35. SRCH_PRC    SEGMENT
  36.     ASSUME    CS:SRCH_PRC,DS:SRCH_FID
  37.     Public    SRCH_PRE
  38.  
  39.                         ;notice.
  40.     DB    'SRCH_PRE - V1.00, Copyright 1987, CoreTechs   ',0DH,0AH
  41.  
  42. SRCH_PRE    Proc    Near
  43.     Call    PUSHALL                ;save registers.
  44.  
  45.     Mov    AX,SRCH_FID            ;setup workarea.
  46.     Mov    DS,AX
  47.  
  48.     Pop    AX                ;discard filename info.
  49.     Pop    AX
  50.  
  51.     Mov    AX,DS:WORD PTR[13]        ;recover filenumber within
  52.                         ;directory and move back to
  53.                         ;previous filename.
  54.  
  55.     Mov    PFILE,AX            ;initialize previous file#s.
  56.     Mov    CFILE,AX
  57.  
  58.     Sub    PFILE,2                ;move back two files because
  59.                         ;call to SRCH_NXT will move
  60.                         ;to next file in list.
  61.  
  62. LOOK:    Mov    AX,PFILE            ;reload filenumber in DTA.
  63.     Mov    DS:WORD PTR[13],AX
  64.  
  65.     Push    AX                ;send in dummy arguments.
  66.     Push    AX
  67.  
  68.     Call    SRCH_NXT            ;search for next file.
  69.  
  70.     Cmp    PFILE,2                ;if search passes first entry
  71.     Jb    LEAV                ;in dir., then abort.
  72.  
  73.     Dec    PFILE                ;else, move to previous file.
  74.  
  75.     Mov    AX,CFILE            ;see if file is before current
  76.     Cmp    DS:WORD PTR[13],AX        ;filenumber.
  77.     Jb    LEAV
  78.  
  79.     Pop    AX                ;drop returned file info
  80.     Pop    AX                ;if this is not the correct
  81.     Pop    AX                ;filename.
  82.     Pop    AX
  83.     Pop    AX
  84.     Pop    AX
  85.     Pop    AX
  86.     Jmp    LOOK                ;continue search.
  87.  
  88. LEAV:    Call    POPALL                ;recover registers.
  89.     Ret
  90.  
  91. SRCH_PRE    Endp
  92.  
  93. SRCH_PRC    Ends
  94.     End
  95.